import java.util.Arrays;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-09-29
 * Time:20:56
 */
public class TestDemo2 {
    public static void rotate(int[] nums, int k) {
        for(int i=0;i<k;i++){
            int tmp=nums[nums.length-1];
            for(int j=1;j<nums.length;j++){
                nums[nums.length-j]=nums[nums.length-j-1];
            }
            nums[0]=tmp;
        }

    }

    public static void main(String[] args) {
        int[] nums=new int[]{-1,-100,3,99};
        System.out.println(Arrays.toString(nums));
        rotate(nums,2);
        System.out.println(Arrays.toString(nums));
    }
}
